<?php
/**
 * WP-iStalker Chrome Min 
 * Theme's functions
 * 
 * @package	WordPress
 * @subpackage	wp-istalker-chrome-min
 * 
 * @category	Template
 * @author	Avice (ChaosKaizer) De'vereux <ck+wp-istalker-min@istalker.net>
 * @author	NH. Noah <noah+wp-istalker-min@kakkoi.net>
 * @copyright 	2007 - 2009 Avice De'vereux, NH. Noah
 * @license 	http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License v2 
 * @version 	CVS: $Id: functions.php 13 2009-01-11 15:22:40Z chaoskaizer $
 * @since 	0.1
 */
 
/**
  * ENV directory separator
  * @since 0.1
  */
if (!defined('DIRSEP')) {
	define('DIRSEP',DIRECTORY_SEPARATOR);
}

require TEMPLATEPATH.DIRSEP.'lib'.DIRSEP.'constant.php';
require WPI_LIB_CLASS.'enum.php';
require WPI_LIB_MOD.'utils.php';

// WPI Min hardcode config
define('WPI_SEO_LV',1); // 0 = disabled, 1 = normal, 2 advanced

class WpiMin
{
   /**
    * WordPress filter id
    * @var mixed|int 
    * @since 0.1
    */   	
	public $wp_filter_id;

   /**
    * Store template error messages
    * @var mixed|array
    * @since 0.1
    */   		
	public $errors = array();

   /**
    * Store client content class object
    * 
    * @var mixed|object
    * @since 0.1
    * @see wpiStyle 
    */  	
	public $Client;
	
	public function __construct(){
		// Include require function files			
		wpi_get_file(str_array(wpiTheme::LOAD_MODULES));
		
		// Include all require classes
		wpi_get_file(str_array(wpiTheme::LOAD_CLASS), wpiTheme::LIB_TYPE_CLASS);
					
		if (is_admin()){
			
		} else {

			/**
			 * WPI Min Template object
			 * @see wpiTemplate 
			 */
			 $this->Template = new wpiTemplate();
			 			
			/**
			 * Frontend stylesheet handler
			 * @see wpiStyle wpiStyle Object 
			 */
			 $this->Client->Style = new wpiStyle();
			 
			/**
			 * Frontend scripts handler
			 * @see wpiScript wpiScript Object 
			 */
			 $this->Client->Script = new wpiScript();			 
			 
			 // default filters
			 wpi_default_filters();
			 
			 //add_action('wp_head',array($this->Client->Style,'dump'));
			 //add_action('wp_head',array($this->Client->Script,'dump'));
			 //add_action('wp_head',array($this,'dump'));
		 }
	}
	
	public function dump()
	{
		wpi_dump($this); exit();	
	}
	
	public function gc(){ unset($this); }
}

$Wpi =& new WpiMin();


register_shutdown_function(array($Wpi,'gc'));
?>
